package com.zhuss.common;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;

import com.zhuss.util.bean.ReflectUtil;

public class Bean {
	
	private List<String> columnList;
	
	public List<String> getColumnList() {
		return columnList;
	}
	
	public void setColumnList(List<String> columnList) {
		this.columnList = columnList;
	}
	
	public Bean dynamicExt() {
		Map<String,Object> propertiesMap = new HashMap<String,Object>();
		for (int i = 0; i < columnList.size(); i ++ ) {
			String column = columnList.get(i) + "";
			propertiesMap.put(column + "", column);
		}
		Object obj = ReflectUtil.getObject(this, propertiesMap);
		BeanUtils.copyProperties(this, obj);
		BeanUtils.copyProperties(obj, this);
		Bean newInstance = (Bean) obj;
		return newInstance;		
	}

}
